package com.example.common.tools

class BtClickUtil {
    private var lastTime: Long = 0

    companion object {

        private const val SPACE_TIME = 1000L
        val instance by lazy(LazyThreadSafetyMode.NONE) {
            BtClickUtil()
        }
    }

    fun isDoubleClick(): Boolean {
        var currentTime = System.currentTimeMillis()
        var timeDifference = currentTime - lastTime
        var isclick = lastTime == 0L || timeDifference > SPACE_TIME
        LogUtils.eLog("isDoubleClick", "currentTime = $currentTime  lastTime = $lastTime")
        if (isclick) {
            lastTime = currentTime
        }
        LogUtils.eLog("isDoubleClick", "isDoubleClick = $isclick")
        return isclick
    }
}

